// Copyright@ChenChao


#include "UI/Widget/GameplayWidget.h"
#include "AbilitySystemBlueprintLibrary.h"
#include "GAS/CAttributeSet.h"
#include "UI/Widget/ValueGauge.h"

void UGameplayWidget::NativePreConstruct()
{
	Super::NativePreConstruct();
	//获取ASC
	OwnerAbilitySystemComponent = UAbilitySystemBlueprintLibrary::GetAbilitySystemComponent(GetOwningPlayerPawn());

	if (OwnerAbilitySystemComponent)
	{
		//生命条绑定数据
		HealthBar->SetAndBoundToGameplayAttribute(OwnerAbilitySystemComponent,
			UCAttributeSet::GetHealthAttribute(),UCAttributeSet::GetMaxHealthAttribute());
		ManaBar->SetAndBoundToGameplayAttribute(OwnerAbilitySystemComponent,
			UCAttributeSet::GetManaAttribute(),UCAttributeSet::GetMaxManaAttribute());
	}
}
